Configure Oracle Database Authentication using Oracle Wallet

Perform the following steps to configure Oracle Database authentication from WebSphere by using Oracle Wallet with mutual TLS (mTLS) over TCPS.

  1. Database Server: Create Server Wallet

    The server wallet stores the Oracle Database server certificate used to establish secure TCPS communication with client applications.

    Execute the following wallet commands one by one. Verify that each command completes successfully before proceeding to the next one. If any command (wallet creation, certificate add, or certificate export) fails, resolve it, and then proceed to the next command.

    mkdir -p <Server wallet path>
    orapki wallet create -wallet <Server wallet path>  -pwd <Server wallet password>  -auto_login
    orapki wallet add -wallet <Server wallet path>  -pwd <Server wallet password>  -dn "<DB server
     certificate DN>"  -keysize 2048  -self_signed -validity 3650
    orapki wallet export -wallet <Server wallet path>  -pwd <Server wallet password>  -dn "<DB server
     certificate DN>"  -cert <Server certificate export path>
  2. Database Server: Update Oracle Net Configuration

    Update the existing listener.ora, sqlnet.ora, and tnsnames.ora files to include the required TCPS and mTLS configuration.

    Important: Do not replace the entire content of these files. Merge the required entries with the existing configuration and preserve any existing database, listener, encryption wallet, or environment-specific settings. Before making the changes, take a backup of the current files. Run the backup commands from the Oracle network admin directory or provide the full file paths.

    cp listener.ora listener.ora.bkp
      cp sqlnet.ora sqlnet.ora.bkp
      cp tnsnames.ora tnsnames.ora.bkp

    listener.ora should include TCPS:

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS =  (PROTOCOL = TCPS)(HOST =  <DB server host>)(PORT =  <DB server TCPS port>))
        )
      )
     
    WALLET_LOCATION =
      (SOURCE =
        (METHOD = FILE)
        (METHOD_DATA =
          (DIRECTORY =  <Server wallet path>)
        )
      )
     
    SSL_CLIENT_AUTHENTICATION = TRUE

    sqlnet.ora should include the wallet and authentication settings:

    NAMES.DIRECTORY_PATH =  (TNSNAMES, EZCONNECT)
    SSL_VERSION =  (1.2)
     
    WALLET_LOCATION =
      (SOURCE =
        (METHOD = FILE)
        (METHOD_DATA =
          (DIRECTORY =  <Server wallet path>)
        )
      )
     
    SQLNET.AUTHENTICATION_SERVICES =  (BEQ, TCPS)
    SSL_CLIENT_AUTHENTICATION = TRUE

    tnsnames.ora should include the following TNS alias:

    LISTENER_ORCL =
      (ADDRESS_LIST =
      (ADDRESS =  (PROTOCOL = TCPS)(HOST =  <DB server host>)(PORT =  <DB server TCPS port>))
      )

    Note: If the existing LISTENER_ORCL alias already contains TCP or other listener addresses, do not remove them. Add the TCPS address by merging it with the existing entry.

    Restart or register:

    lsnrctl stop
    lsnrctl start
    sqlplus / as sysdba
    ALTER SYSTEM SET LOCAL_LISTENER='LISTENER_ORCL' SCOPE=BOTH;
    ALTER SYSTEM REGISTER;
    EXIT;

    Verify:

    lsnrctl status
    lsnrctl services
  3. Database Server: Create Client Wallet for WebSphere

    The client wallet stores the client certificate that WebSphere presents to the Oracle Database during authentication.

    Execute the following wallet commands one by one. Verify that each command completes successfully before proceeding to the next one. If any command (wallet creation, certificate add, or certificate export) fails, resolve it, and then proceed to the next command.

    mkdir -p <Client wallet staging path>
    orapki wallet create -wallet <Client wallet staging path>  -pwd <Client wallet password>  -auto_login
    orapki wallet add -wallet <Client wallet staging path>  -pwd <Client wallet password>  -dn "<Client certificate
     DN>"  -keysize 2048  -self_signed -validity 3650
    orapki wallet export -wallet <Client wallet staging path>  -pwd <Client wallet password>  -dn "<Client certificate
     DN>"  -cert <Client certificate export path>

    Trust DB server cert in client wallet:

    orapki wallet add -wallet <Client wallet staging path>  -pwd <Client wallet password>  -trusted_cert -cert <Server certificate export path>

    Trust client cert in DB server wallet:

    orapki wallet add -wallet <Server wallet path>  -pwd <Server wallet password>  -trusted_cert -cert <Client certificate export path>

    Verify

    orapki wallet display -wallet <Server wallet path>  -summary
    orapki wallet display -wallet <Client wallet staging path>  -summary

    Restart the listener once server wallet changes

    lsnrctl stop
    lsnrctl start

    Note: The client certificate DN created in this step maps to the Oracle schema used for authentication.

    For example, this client certificate:

    CN=OIPA_NOPASS,O=LocalLab,C=IN

     

    must map to  this  Oracle user:
     
    CREATE USER OIPA_NOPASS
     IDENTIFIED EXTERNALLY AS 'CN=OIPA_NOPASS,O=LocalLab,C=IN';
     
    For
      another passwordless schema, create a separate client wallet and client certificate with  a different Subject  DN.
     
    Example  for two passwordless schemas:
     
    Schema  1:
    OIPA_NOPASS
     
    Client certificate DN:
    CN=OIPA_NOPASS,O=LocalLab,C=IN

     

    Client wallet:
     /opt/app/mtls/client_wallet_oipa_nopass
     
    TNS_ADMIN:
     /opt/app/mtls/net_oipa_nopass
     
    Schema  2:
    OIPA_READONLY
     
    Client certificate DN:
    CN=OIPA_READONLY,O=LocalLab,C=IN

     

    Client wallet:
     /opt/app/mtls/client_wallet_oipa_readonly
     
    TNS_ADMIN:
     /opt/app/mtls/net_oipa_readonly

    Each WebSphere datasource should reference to the TNS_ADMIN folder and client wallet that that correspond to the Oracle schema used for authentication.

  4. Database Server: Create or Alter Externally Authenticated Schema

    sqlplus / as sysdba
     
    -- For an existing schema:
    ALTER USER <Oracle schema name> IDENTIFIED EXTERNALLY AS '<Client certificate DN>';

     

    -- For a new schema:
    CREATE USER <Oracle schema name> IDENTIFIED EXTERNALLY AS '<Client certificate DN>';
    GRANT DBA,CREATE TABLE TO <Oracle schema name>;

    Note:
    In customer environments, grant only the roles and privileges required by the application or schema. DBA privileges should be granted only if explicitly required and approved by the customer’s database security policy.

    For each externally authenticated Oracle schema, create or use a client certificate with a unique Subject DN. Map the Subject DN to the Oracle schema by using IDENTIFIED EXTERNALLY AS. Ensure that the WebSphere client wallet trusts the Oracle Database server certificate or CA, and that the Oracle Database server wallet trusts the client certificate or CA.

    Verify the Schema

    SELECT username, external_name FROM dba_users WHERE username = '<Oracle schema name>';
    EXIT;
  5. Copy Client Wallet and JDBC Jars to WebSphere Server

    ssh <WebSphere server user>@<WebSphere server host>  "mkdir -p
     <mTLS base path on WebSphere server> <JDBC jar path on WebSphere
     server>"
    scp -r <Client wallet staging path>  <WebSphere server user>@<WebSphere server host>:<mTLS
     base path on WebSphere server>/

    Copy the matching Oracle Database 19c JDBC and Oracle Wallet libraries.

    scp <Oracle home>/jdbc/lib/ojdbc8.jar <WebSphere
     server user>@<WebSphere server host>:<JDBC jar path on WebSphere
     server>/
    scp <Oracle home>/jlib/oraclepki.jar <WebSphere
     server user>@<WebSphere server host>:<JDBC jar path on WebSphere
     server>/
    scp <Oracle home>/jlib/osdt_core.jar <WebSphere
     server user>@<WebSphere server host>:<JDBC jar path on WebSphere
     server>/
    scp <Oracle home>/jlib/osdt_cert.jar <WebSphere
     server user>@<WebSphere server host>:<JDBC jar path on WebSphere
     server>/

    Use matching Oracle JDBC and Oracle Wallet libraries from the same Oracle home and version. Do not mix an older ojdbc8.jar with newer oraclepki.jar, osdt_core.jar, or osdt_cert.jar.

    On the WebSphere server:

    chmod 755 <mTLS base path on WebSphere server>
    chmod 700 <Client wallet path on WebSphere server>
    chmod 600 <Client wallet path on WebSphere server>/*

    The WebSphere runtime user must own or be able to read the client wallet files. Do not store the client wallet in a temporary directory such as /tmp, because the files may be removed after a system restart or cleanup.

  6. WebSphere Server: Create Client Oracle Net Files

    mkdir -p <Client TNS_ADMIN path on WebSphere server>

    Create the tnsnames.ora file in <Client TNS_ADMIN path on WebSphere server> with the following content:

    OIPA_NOPASS_MTLS =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCPS)(HOST = <DB server host>)(PORT = <DB server TCPS port>))
    (CONNECT_DATA = (SERVICE_NAME = <DB service name>))
    (SECURITY =
    (SSL_SERVER_DN_MATCH = TRUE)
    (SSL_SERVER_CERT_DN = "<DB server certificate DN>")
    )
    )

    Create <Client TNS_ADMIN path on WebSphere server>/sqlnet.ora with the following content:

    WALLET_LOCATION =
      (SOURCE =
      (METHOD = FILE)
      (METHOD_DATA =
      (DIRECTORY = <Client wallet path on
     WebSphere server>)
      )
      )
     
    SQLNET.AUTHENTICATION_SERVICES = (TCPS)
    SSL_CLIENT_AUTHENTICATION = TRUE
    NAMES.DIRECTORY_PATH = (TNSNAMES)
    SSL_VERSION = (1.2)
  7. WebSphere: Configure mTLS JDBC Provider Classpath

    Use matching Oracle JDBC and Oracle Wallet libraries from the same Oracle home and version. Do not mix different versions of ojdbc8.jar, oraclepki.jar, osdt_core.jar, and osdt_cert.jar.

    Classpath:

    <JDBC jar path on WebSphere server>/ojdbc8.jar
    <JDBC jar path on WebSphere server>/oraclepki.jar
    <JDBC jar path on WebSphere server>/osdt_core.jar
    <JDBC jar path on WebSphere server>/osdt_cert.jar

  8. WebSphere: Create or Update Datasource under the mTLS JDBC Provider

    URL: jdbc:oracle:thin:/@OIPA_NOPASS_MTLS

    Do not configure the following values separately in the datasource:

    user
    password
    serverName
    portNumber
    databaseName

    Note: Leave all security aliases as (none). Do not configure component-managed, container-managed, XA recovery, or mapping authentication aliases.

    Add the following datasource custom property:

    Name: connectionProperties
    Type: java.lang.String
    Value:
    oracle.net.tns_admin=<Client TNS_ADMIN path on WebSphere server>;oracle.net.authentication_services=(TCPS);oracle.net.ssl_client_authentication=true;oracle.net.wallet_location=file:<Client wallet path on WebSphere server>/cwallet.sso

  9. Validate the Configuration

    Save the configuration and restart the target WebSphere application server. Once the server restarts:

    1. Start the OIPA application.

    2. Verify that OIPA starts successfully without any database connection errors.

    3. Perform a few standard OIPA operations (for example, Policy Search or Client Activity) to confirm that OIPA can successfully connect to the Oracle Database using Oracle Wallet authentication.